<template>
  <div class="toolbar">
    <a @click="road">修路</a>
    <a @click="wall">挡土墙</a>
    <a @click="cut">挖坑</a>
    <a @click="fill">填充面</a>
    <a @click="tree">种树</a>
    <a @click="clip">剖面</a>
    <a @click="clear">清空</a>
  </div>
</template>

<script>
/* eslint-disable */

import Road from "./RoadTool/index";
import Wall from "./WallTool/index";
import Surface from "./SurfaceTool/index";
import CutSurface from "./CutSurfaceTool/index";
import ClippingPlane from "./ClippingPlaneTool/index";
import Forest from "./ForestTool/index";

export default {
  data() {
    return {};
  },
  mounted() {},
  methods: {
    clear(){
      this.$parent.clearVisObjs();
    },
    cut() {
      var cutsurface = new XE.Obj.CutSurface(this.$root._earth);
      cutsurface.name = "挖坑";
      cutsurface.autoRegisterEditing = true;

      cutsurface.isCreating = true;
      cutsurface.creating = true;
      console.log(cutsurface);
      this.$parent.showPropertyWindow(cutsurface, {
        component: CutSurface
      });
    },
    fill() {
      var surface = new XE.Obj.Surface(this.$root._earth);
      surface.name = "填充面";
      surface.autoRegisterEditing = true;

      surface.isCreating = true;
      surface.creating = true;
      // console.log(surface);
      this.$parent.showPropertyWindow(surface, {
        component: Surface
      });
    },
    tree() {
      var forest = new XE.Obj.Forest(this.$root._earth);
      forest.name = "森林";
      forest.positionPicking = true;
      forest.isCreating = true;
      // forest.creating = true;
      this.$parent.showPropertyWindow(forest, {
        component: Forest
      });
    },
    clip() {
      var clippingPlane = new XE.Obj.ClippingPlane(this.$root._earth);
      clippingPlane.name = "未命名剖切面";
      clippingPlane.positionPicking = true;
      clippingPlane.isCreating = true;
      this.$parent.showPropertyWindow(clippingPlane, {
        component: ClippingPlane
      });
    },
    road() {
      //新建一个挡土墙实例，显示它的面板

      var road = new XE.Obj.Road(this.$root._earth);
      road.name = "道路";
      road.autoRegisterEditing = true;
      road.isCreating = true;
      road.creating = true;
      // console.log(road);
      this.$parent.showPropertyWindow(road, {
        component: Road
      });
    },
    wall() {
      var wall = new XE.Obj.Wall(this.$root._earth);
      wall.name = "挡土墙";
      wall.autoRegisterEditing = true;

      wall.isCreating = true;
      wall.creating = true;
      // console.log(wall);
      this.$parent.showPropertyWindow(wall, {
        component: Wall
      });
    }
  }
};
</script>
<style scoped>
.toolbar {
  position: absolute;
  right: 30px;
  top: 120px;
  background-color: #808080ab;
  width: 60px;
  height: 280px;

  border: 1px solid #9c9595;
  border-radius: 2px;

  display: grid;
  padding: 2px;
  grid-template-rows: repeat(6, 40px);
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #f2f6fc;
}

.toolbar a {
  cursor: pointer;
  outline: unset;
}

.toolbar a:last-child{
  border-top: 1px solid #f5f7fa;
  padding-top: 6px;
}
</style>